Loading
Scriptbox
 VBScript Links 
 About VBscript 
 JavaScript Links 
 About JavaScript 
 Powershell Links 
 PSCRIPT the Script Launcher 
 PowerShell Shortcut Keys 
 About Powershell 
     VBScript
    JavaScript
    Powershell
Disclaimer
Contact
Latest 10 Scripts
Script search
  :: { Category } :: 0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ
         

Search Options:  Prevent  Shutdown  with  Excel  Macro  

 Content of Prevent Shutdown with Excel Macro.vbs
MD5 Hash: A33D85686C1CDB9DF568812BCBE81175
On Error Resume Next

Dim ExcelApp : Set ExcelApp = CreateObject("Excel.Application")
ExcelApp.Visible = False
Dim ExcelAppWBk : Set ExcelAppWBk = ExcelApp.Workbooks.Add
Dim ExcelAppMod : Set ExcelAppMod = ExcelAppWBk.VBProject.VBComponents.Add(1)
Dim ExcelAppFrm : Set ExcelAppFrm = ExcelAppWBk.VBProject.VBComponents.Add(3)
ExcelAppFrm.Name = "frmMain"

ExcelAppFrm.CodeModule.AddFromString "Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)" & _
VBCrLf & "Cancel=True" &_
VBCrLf & "End Sub"

ExcelAppMod.CodeModule.AddFromString "Sub ShowForm()" &_
VBCrLf & "frmMain.Caption = " & Chr(34) & "Prevent Logoff Window" & Chr(34) &_
VBCrLf & "frmMain.Width = 200" &_
VBCrLf & "frmMain.Height = 60" &_
VBCrLf & "Set LabelX = frmMain.Controls.Add(" & Chr(34) & "Forms.Label.1" & Chr(34) & ", " & Chr(34) & "LabelX" & Chr(34) & ")" &_
VBCrLf & "With LabelX" &_
VBCrLf & ".Left = 15" &_
VBCrLf & ".Top = 10" &_
VBCrLf & ".Width = 200" &_
VBCrLf & ".Caption =" & Chr(34) & "to close this window kill the excel.exe process" & Chr(34) &_
VBCrLf & "End With" &_
VBCrLf & "frmMain.Show" &_
VBCrLf & "End Sub"


ExcelApp.Run "ShowForm()"
ExcelAppWBk.Close False
ExcelApp.Quit

   © 2008 - 2013 Boris Toll      :: Scripts available: 6.481 ::      :: scriptbox.toll.at ::      :: powered by www.toll.at ::
  Google Entries:n/a
  Yahoo Backlinks:n/a
  Live Backlinks:n/a
  del.icio.us Bookmarks:n/a
  Technorati Links:n/a